<link href="/theme/Default/css/member/manage.css" rel="stylesheet">
<?php echo $this->Session->flash(); ?>
	  		<?php echo $this->element('errors'); ?>
<?php if (!empty($posts)): ?>
<div class="tabs-container">
<div class="tab-content">
	<div id="stalls-add">
	<h4 class="stalls_header">Các tin đã đăng
			</h4>
	</div>
	  	<div role="tabpanel" class="tab-pane active" id="tab-all">
	  	<table class="table table-striped">
		        <thead>
		          <tr>
		            <th>STT</th>
		            <th>Tin đăng</th>
		            <th>Tình trạng</th>
		            <th>Up</th>
		            <th>Sửa</th>
		            <th>Xóa</th>
		          </tr>
		        </thead>
		        <tbody>
		        	<?php $i = 1; ?>
		        	<?php foreach ($posts as $item): ?>
		        		<tr>
				            <td><?php echo $i++; ?></td>
				            <td class = 'row'>
				            	<div class="tab-detail">
				            	  <?php $url = "/detail/".$item['Post']['short_url'] ;?> 
								  <div class="detail-one">
										<a href=
										"<?php echo $item['Post']['check_status'] == 1?$url:"javascript:void(0)"; ?>">
											<img src="/<?php echo $item['Post']['image_icon']?>"/>
										</a>
									</div>
									<div class="detail-two">
										<div class="detail-title">
											<a href=
											"<?php echo $item['Post']['check_status'] == 1?$url:"javascript:void(0)"; ?>">
											<?php echo $item['Post']['title_vn']?></a>
										</div>
										<div class="detail-price">
											<?php echo number_format($item['Post']['price']);?> VNĐ
										</div>
									</div>
								</div>
				            </td>
				            <td class='status'>
				            	<?php if ($item['Post']['check_status']): ?>
				            		<div>Đã duyệt</div>
				            	<?php else: ?>
				            		<div>Chưa duyệt</div>
				            	<?php endif ?>
				            </td>
				            <td class='icon'>
				            	<?php echo $this->Form->postLink($this->Html->image("up-icon.png"),array('controller'=>'member','action'=>'uptop',$item['Post']['id']),array('escape' => false), __('Up tin đăng này lên Top?')); ?>
				        	</td>
				        	<td class='icon'>
				            	<a href='/quan-ly-user/tin-dang/chinh-sua/<?php echo $item['Post']['short_url']; ?>'>
				            		<img src="/theme/Default/img/edit_icon.png"/></a>
				        	</td>
				        	<td class='icon'>
				            	<?php echo $this->Form->postLink($this->Html->image("delete-icon.png"),array('controller'=>'member','action'=>'deletepost',$item['Post']['id']),array('escape' => false), __('Xác nhận xóa tin đăng này?')); ?>
				        		
				            	<!-- <a href=""><img src="/theme/Default/img/delete-icon.png"/></a> -->
				        	</td>
				          </tr>
		        	<?php endforeach ?>
		        </tbody>
		    </table>
	  	</div>
	</div>
</div>
<?php else: ?>
		<div id="stalls-add">
		<h4>Chưa có tin đăng nào!
				</h4>
		</div>
<?php endif ?>
